package com.chi.serviceImpl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.chi.dao.LeavesDao;
import com.chi.page.Page;
import com.chi.pojo.Advise;
import com.chi.pojo.Leaves;
import com.chi.service.LeavesService;
@Service("leavesservice")
public class LeavesServiceImpl implements LeavesService {
@Autowired
private LeavesDao leavesDao;
@Override
public List<Leaves> findAll(int pageNo) {
	List<Leaves> leaves = new ArrayList<Leaves>();
	try {
		leaves = leavesDao.findAll(pageNo);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return leaves;
}

@Override
public Page<Leaves> getPage(int pageNo) {
	Page<Leaves> page = null;
	try {
		page = leavesDao.findByPage(pageNo);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return page;
}

@Override
public int getCount() {
	int in = 0;
	try {
		in = leavesDao.getTotalNum();
	} catch (Exception e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
	return in;
}
}
